import gmpy2
import libnum


p2 =  8345774537268501775456149547604093811537369706242159709058405913660493926215699313366059497170577713800176152866821540944395025269529309431564563983026047
q2 =  10391251387900816431089217882564594263543706933015218000664649428273018708690965953263846227725465978045419390050088292820030415626410428034269853834640767
c3 =  70057129621004770704688083264954773868924488489858841648741006057913061247128697063230635204818097097989773079555422507429472690950271096686354023051578709918278343598395904697714639469429943421928621364157106993940737884253250276769074919155850720804529008723376094183112401317966966358905432385347745890161
e=2
n=p2*q2

inv_p = gmpy2.invert(p2, q2)
inv_q = gmpy2.invert(q2, p2)
mp = pow(c3, (p2 + 1) // 4, p2)
mq = pow(c3, (q2 + 1) // 4, q2)
a = (inv_p * p2 * mq + inv_q * q2 * mp) % n
b = n - int(a)
c = (inv_p * p2 * mq - inv_q * q2 * mp) % n
d = n - int(c)
# 因为rabin 加密有四种结果，全部列出。
aa = [a, b, c, d]
for i in aa:
    if gmpy2.is_prime(i):
        print(i)
    #print(libnum.n2s(int(i)))
